package com.itheima.exerciseTest.test10_19;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test19 {
    public static void main(String[] args) throws ParseException {
        // 创建模板对象
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

        // 创建出生时间
        String start = "2000-10-12";
        Date startDate = simpleDateFormat.parse(start);
        long startDateTime = startDate.getTime();

        // 创建当前时间
        Date nowDate = new Date();
        long nowDateTime = nowDate.getTime();

        long day = (nowDateTime - startDateTime) / 1000 / 60 / 60 / 24;
        System.out.println(day);

        // 创建2080 - 10 - 12年时间
        String end = "2080-10-12";
        Date endDate = simpleDateFormat.parse(end);
        long endDateTime = endDate.getTime();

        long day2 = (endDateTime - startDateTime - day) / 1000 / 60 / 60 / 24;
        System.out.println(day2);
    }
}
